package com.yunfeisoft.business.service.impl;

import com.applet.base.BaseServiceImpl;
import com.applet.sql.separation.DataSourceChange;
import com.applet.utils.Page;
import com.yunfeisoft.business.dao.inter.SmsFlashPromotionDao;
import com.yunfeisoft.business.model.SmsFlashPromotion;
import com.yunfeisoft.business.service.inter.SmsFlashPromotionService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * ClassName: SmsFlashPromotionServiceImpl
 * Description: 限时购表service实现
 * Author: Jackie liu
 * Date: 2020-06-02
 */
@Service("smsFlashPromotionService")
public class SmsFlashPromotionServiceImpl extends BaseServiceImpl<SmsFlashPromotion, String, SmsFlashPromotionDao> implements SmsFlashPromotionService {

    @Override
    @DataSourceChange(slave = true)
    public Page<SmsFlashPromotion> queryPage(Map<String, Object> params) {
        return getDao().queryPage(params);
    }

    @Override
    public int modifyOnlineStatus(String id, int onlineStatus) {
        if (StringUtils.isBlank(id)) {
            return 0;
        }

        SmsFlashPromotion promotion = new SmsFlashPromotion();
        promotion.setId(id);
        promotion.setOnlineStatus(onlineStatus);
        return getDao().update(promotion);
    }
}